package com.dhu719.label_end.controller;

import com.dhu719.label_end.domain.User;
import com.dhu719.label_end.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>Title: $file.className</p>
 * <p>Description: </p>
 *
 * @author Kaboon
 * @date
 */
@RestController
@RequestMapping(value = "/user", produces = {"application/json;charset=UTF-8"})
public class UserController {
    @Autowired
    private UserService userService;

    @RequestMapping(value = "/login",method = RequestMethod.GET)
    public User userLogin(@RequestParam(value = "username") String username,
                          @RequestParam(value = "password") String password){
        return userService.checkLogin(username,password);
    }

    @RequestMapping(value = "insert",method = RequestMethod.POST)
    public String insertUser(@RequestBody User user){
        return userService.AddUser(user);
    }
}
